using Gtk;
using System;
using System.Data;

namespace Serpis
{
	[System.ComponentModel.ToolboxItem(true)]
	public partial class MiTreeView : MiBin
	{
		private TreeViewHelper treeViewHelper;
		
		public MiTreeView ()
		{
			this.Build ();
		}
		
		public void Init(IDbConnection dbConnection, string commandText)
		{
			treeViewHelper = new TreeViewHelper(treeView, dbConnection, commandText);
			treeViewHelper.Changed += delegate {
				raiseChanged();
			};
		}
		
		public bool HasSelected 
		{
			get 
			{
				return treeViewHelper.HasSelected;
			}
		}
		
		public object GetValue(int columnIndex)
		{
			return treeViewHelper.GetValue(columnIndex);
		}
		
		public void Refresh()
		{
			treeViewHelper.Refresh();
		}
		
		public void Refresh(string commandText)
		{
			treeViewHelper.Refresh(commandText);
		}
	}
}
